package com.leyou.user.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import javax.validation.constraints.NotEmpty;

import org.hibernate.validator.constraints.Length;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;
import java.util.Date;

/**
 * @author linzx
 * @date 2020/3/29
 */
@Data
@Table(name = "tb_user")
public class User {
   @Id
   @KeySql(useGeneratedKeys = true)
    private Long id;
   @NotEmpty(message = "用户名不能为空")
   @Length(min = 4 ,max = 32,message = "用户名长度必须在4~32位之间")
    private String username;
    @JsonIgnore
    @NotEmpty(message = "密码名不能为空")
    @Length(min = 4 ,max = 32,message = "密码长度必须在4~32位之间")
    private String password;
    @Pattern(regexp = "^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$" ,message = "手机格式不正确")
    private String phone;
    private Date created;
    @JsonIgnore
    private String salt;

}
